<template>
	<view class="houseDetail">
		<!-- <navBar isBack backColor="#000" background="transparent"></navBar> -->
		<nav-bars ref="navBar" :scrollTop="scrollTop" transparentFixedFontColor="#FFF" type="transparentFixed" :title="titleText"></nav-bars>
		<view class="topImg">
			<!-- <image :src="houseInfo.thumb_url" mode=""></image> -->
			<swiper class="swiper" indicator-dots autoplay interval="3000" indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#fff" circular>
				<swiper-item v-for="(item, index) in houseInfo.thumb_url" :key="index"><image :src="item.path" mode=""></image></swiper-item>
			</swiper>
			<!-- <view class="shadow">
				<view class="uP_5Dicon iconfont">&#xe66e;</view>
				3D
			</view> -->
		</view>
		<!-- :style="'top:'+navHeight+'rpx;'" -->
		<view class="content">
			<view class="topInfo">
				{{ houseInfo.house_type }} | {{ houseInfo.area }}m²
				<p>{{ houseInfo.title }}</p>
			</view>
			<!-- <view style="color: #333;font-size: 30rpx;">{{houseInfo.desc}}</view> -->
			<view class="houseList">
				<h3>
					户型装修案例（{{ houseInfo.case_num }}）
					<i class="iconfont icon-jinru"></i>
				</h3>

				<view class="item" v-for="(item, index) in houseInfo.case_list" :key="index" @click="toDetail(item.id)">
					<view class="itemImg">
						<swiper
							class="swiper"
							indicator-dots
							autoplay
							interval="3000"
							indicator-color="rgba(255,255,255,0.5)"
							indicator-active-color="#fff"
							circular
							v-if="Array.isArray(item.thumb_url)"
						>
							<swiper-item v-for="(item1, index1) in item.thumb_url" :key="index1"><image :src="item1.path" mode=""></image></swiper-item>
						</swiper>
						<!-- <swiper class="swiper" indicator-dots autoplay interval="3000" indicator-color="rgba(255,255,255,0.5)"
						 indicator-active-color="#fff" circular v-else>
							<swiper-item>
								<image :src="item.thumb_url.path" mode=""></image>
							</swiper-item>
						</swiper> -->
						<!-- <view class="itemShadow" v-if="item.is_display == 1">
							<view class="uP_5Dicon iconfont">&#xe66e;</view>
							3D
						</view> -->
					</view>
					<view class="itemInfo">
						<view v-if="Array.isArray(item.design_style)">
							<span v-for="(item2, index2) in item.design_style" :key="index2">{{ item2.name }}</span>
						</view>
						<view v-else>
							<span>{{ item.design_style.name }}</span>
						</view>
						{{ item.area }}m² | {{ houseInfo.house_type }} | {{ item.offer }}万
					</view>
					<p>{{ item.title }}</p>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import service_oneN from '@/service/oneN.js';
export default {
	data() {
		return {
			baseImg: 'http://manager.ryz1620.com',
			navHeight: 400,
			house_id: null,
			houseInfo: {},
			page: 1,
			pagesize: 10,
			scrollTop: 0,
			titleText: ''
		};
	},
	onPageScroll(e) {
		let scrollTop = e.scrollTop;
		this.scrollTop = scrollTop;
		if (e.scrollTop >= 100) {
			this.titleText = '户型详情';
		} else {
			this.titleText = '';
		}
	},
	onLoad(options) {
		this.$utils.getUrl()
		this.house_id = options.house_id;
		// this.navHeight =540 - (Number(this.$store.state.system.navBarHeight)*2);
		this.getHouseDetail();
	},
	methods: {
		toDetail(id) {
			// uni.navigateTo({
			// 	url: '/pages_view/pages/desiginview/deatil?house_id=' + id
			// });
			uni.navigateTo({
				url: '/pages_design/pages/design/demo/demo?caseId=' + id
			})
		},
		// 获取户型详情
		getHouseDetail() {
			let params = {
				house_id: this.house_id,
				page: this.page,
				pagesize: this.pagesize
			};
			service_oneN.getHouseDetail(params).then(res => {
				console.log(res);
				if (res.code == 1) {
					this.houseInfo = res.data ? res.data : {};
				}
			});
		}
	}
};
</script>

<style lang="scss">
@import '../iconfont.css';
page {
	height: 100%;
}
.houseDetail {
	height: 100%;
	background-color: #fff;
	position: relative;
	.topImg {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 540rpx;
		image {
			width: 100%;
			height: 100%;
		}
		.shadow {
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			margin: auto;
			padding: 18rpx 0 10rpx 0;
			text-align: center;
			width: 102rpx;
			height: 102rpx;
			color: #fff;
			font: 400 24rpx/34rpx PingFang SC;
			background-color: rgba(0, 0, 0, 0.4);
			border: 2rpx solid rgba(255, 255, 255, 0.4);
			border-radius: 50%;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
		}
	}

	// 内容
	.content {
		position: absolute;
		left: 0;
		top: 500rpx;
		width: 100%;
		height: 100%;
		background-color: #fff;
		background-color: #fff;
		z-index: 10;
		border-radius: 24rpx 24rpx 0 0;
		padding: 36rpx 32rpx;
		.topInfo {
			font: 600 36rpx/50rpx PingFangSC-Semibold;
			color: #ff6561;
			p {
				font: 400 28rpx/48rpx PingFang SC;
				color: #333333;
			}
		}
		.houseList {
			width: 100%;
			margin-top: 60rpx;
			h3 {
				display: flex;
				justify-content: space-between;
				align-items: center;
				font: 600 36rpx/50rpx PingFang SC;
				color: #333333;
				i {
					font-size: 24rpx;
					color: #cccccc;
				}
			}
			.item {
				padding: 40rpx 0;
				border-bottom: 2rpx solid #f4f4f4;

				.itemImg {
					position: relative;
					width: 686rpx;
					height: 376rpx;
					border-radius: 16rpx 16rpx 0 0;
					overflow: hidden;
					image {
						width: 686rpx;
						height: 376rpx;
					}
					.itemShadow {
						position: absolute;
						top: 0;
						left: 0;
						right: 0;
						bottom: 0;
						margin: auto;
						padding: 18rpx 0 10rpx 0;
						text-align: center;
						width: 102rpx;
						height: 102rpx;
						color: #fff;
						font: 400 24rpx/34rpx PingFang SC;
						background-color: rgba(0, 0, 0, 0.4);
						border: 2rpx solid rgba(255, 255, 255, 0.4);
						border-radius: 50%;
						display: flex;
						flex-direction: column;
						justify-content: space-between;
					}
				}
				.itemInfo {
					margin: 18rpx 0 8rpx 0;
					display: flex;
					padding-left: 16rpx;
					align-items: center;
					font: 400 24rpx/44rpx PingFangSC-Regular;
					color: #333;
					span {
						padding: 4rpx 20rpx;
						background-color: #f9f6f3;
						font: 400 20rpx/36rpx PingFang SC;
						color: #a98f68;
						margin-right: 16rpx;
						border-radius: 18rpx;
					}
				}
				p {
					width: 670rpx;
					padding-left: 16rpx;
					font: 600 32rpx/44rpx PingFang SC;
					color: #333;
				}
			}
		}
	}
}
</style>
